package cn.edu.zju.gis.disasterBE.sever.dao;
import cn.edu.zju.gis.disasterBE.sever.entity.TwitterEmotion;
import cn.edu.zju.gis.disasterBE.sever.entity.TwitterQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface TwitterEmotionDAO extends BaseMapper<TwitterQuery> {

    //随机获取12条推特join情感系数
    @Select("SELECT sw.tweet_id tweetId,sw.user_name username,sw.tweet_text tweetText,sw.comment_count commentCount,sw.share_count shareCount,sw.like_count likeCount,sw.image_url imageUrl,swe.positive positive,swe.negative negative  from search_tweet_emotionvalue swe natural join search_tweet sw order by random() limit 12")
    @Results({
            @Result(column="tweetId",property = "tweetId"),
            @Result(column="username",property = "username"),
            @Result(column="tweetText",property = "tweetText"),
            @Result(column="commentCount",property = "commentCount"),
            @Result(column="shareCount",property = "shareCount"),
            @Result(column="likeCount",property = "likeCount"),
            @Result(column="imageUrl",property = "imageUrl"),
            @Result(column="positive",property = "positive"),
            @Result(column="negative",property = "negative"),
    })
    List<TwitterQuery> getTwitterEmotion12();
}
